'use strict';

const Controller = require('egg').Controller;

class RegisterController extends Controller {
  async getCode() {
    const { ctx } = this;
    const tel = ctx.params.tel;
    if (tel) {
      const result = await ctx.service.registerUser.moiter(tel);
      console.log(tel, result)
      ctx.body = result;
    }
  }
  async regTelSend() {
    const { ctx } = this;
    const tel_Code = ctx.request.body;
    console.log(tel_Code)
    if (tel_Code) {
      await ctx.service.registerUser.verifTel(tel_Code);
    }
  }
  async register() {
    const { ctx } = this;
    const regInfo = ctx.request.body;
    const result = await ctx.service.registerUser.register(regInfo);
    ctx.body = result;
  }
}

module.exports = RegisterController;
